package com.zzvcom.sms.entity;


import com.zzvcom.sms.exception.AppParamException;

import java.math.BigDecimal;
import java.util.Map;

/**
 * <p>应用上报开始临时停车参数</p>
 *
 * @author huanghailong
 * @since 2022/05/11
 */
public class AppPauseParam extends AppLocationMopedParam {

    /**
     * 临停类型：0为主动临时停车，1为静止未还车
     */
    private final Integer type;

    public AppPauseParam(String appKey,
                         String companyCode,
                         String licensePlateNumber,
                         String rfidPlateNumber,
                         String vin,
                         Integer type,
                         BigDecimal longitude,
                         BigDecimal latitude,
                         Long timestamp,
                         String nonce) {
        super(appKey,
                companyCode,
                licensePlateNumber,
                rfidPlateNumber,
                vin,
                longitude,
                latitude,
                timestamp,
                nonce);
        if (type == null) {
            throw new AppParamException("临停类型不存在");
        }
        this.type = type;
    }

    @Override
    public Map<String, String> toMap() {
        Map<String, String> treeMap = super.toMap();
        treeMap.put("type", this.type.toString());
        return treeMap;
    }

}
